package com.zzyl.mapper;

import com.zzyl.entity.NursingPlanProject;
import com.zzyl.vo.ProjectPlanVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NursingPlanProjectMapper {

    @Insert(" INSERT INTO nursing_project_plan (plan_id, project_id, execute_time, execute_cycle, execute_frequency, create_time, update_time, create_by, update_by, remark)" +
            "VALUES (#{planId}, #{projectId}, #{executeTime}, #{executeCycle}, #{executeFrequency}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{remark})")
    void addPlanProject(NursingPlanProject nursingPlanProject);

    @Select("select *,p.name projectName from nursing_project_plan pp,nursing_project p where pp.project_id = p.id and plan_id = #{id}")
    List<ProjectPlanVO> getByPlanId(Long id);

    @Delete("delete from nursing_project_plan where plan_id = #{planId}")
    void delete(int planId);
}
